home *** CD-ROM | disk | FTP | other *** search
- Path: american.edu!JW1675A
- From: JW1675A@american.edu (James D. Watson)
- Newsgroups: comp.lang.c
- Subject: Can't debug into a function; likely a code problem
- Date: Sun, 03 Mar 96 14:00:11 EST
- Organization: The American University
- Message-ID: <1773FC4EBS86.JW1675A@american.edu>
- NNTP-Posting-Host: auvm.american.edu
-
- Good afternoon --
- I'm having a problem that has manifested itself in a very odd way: While
- debugging my program I cannot step into this function, although it seems to
- return ok, and runs ok outside the debugger. (Yes, compiled with debugging
- on ;-)
-
- Platform: Sun SPARC2, SunOS 4.1.3, using ANSI C and dbx.
-
- Here's the manner of the code:
-
- typedef struct {
- ...
- } tsType1;
-
- typedef struct {
- ...
- } tsType2; /* tsType1 and tsType2 are different sizes with
- different elements */
-
- typedef struct {
- char sData[100];
- tsType1 *t1;
- tsType2 *t2;
- } tsRecord;
- typedef enum { getType1, getType2 } TYPE_TO_GET;
-
- /*************************************************/
- main(...) {
- extractData(argv[1]);
- ...
- }
-
- /*************************************************/
- int extractData(const char *sFilename) {
- tsRecord rec;
- ...
- if(!readRecord(sFilename, getType1, (void*)&(rec.t1))) {
- /* error */
- }
- ...
- }
-
- /*************************************************/
- bool readRecord(const char *sFilename, const TYPE_TO_GET eWhich,
- (void**)ptr) {
-
- FILE *f;
- ...
- /* nothing done with f or any of the parameters yet */
- if(!openFile(&f, eWhich, "rb", (const char *sFilename))) {
- /* error */
- }
- ... /* do normal casting of ptr, malloc() for it, and fill it*/
- return(TRUE);
- }
-
- /*************************************************/
- bool openFile(FILE **f, const TYPE_TO_GET eWhich, const char *sMode,
- const char *sFilename) {
-
- ...
- *f=fopen(sFilename, sMode);
- if(*f==(FILE*)NULL) {
- perror(sFilename);
- return(FALSE);
- }
- ...
- return(TRUE);
- }
-
- /* end code example */
-
- It's this last function -- openFile() -- that I can't step into.
- I can get into readRecord() fine. Once I step into the openFile() call,
- I get into some assembler code (sethi %.. %g1). It's almost as if this
- one particular function didn't get compiled with debugging info, but it
- did -- it's all part of one file with the other functions (only main() is
- in another .c file).
-
- Anyway, if I do "dump" (dbx-ese for "show all local variables), sometimes
- I have a <bad address> for one of the temporary variables -- labeled
- #tmpnn on this system -- and I have no idea what that is a reference for.
-
- So, even though the function seems to work fine, I have a paranoid feeling
- that this is symptomatic of a larger problem. I've included a malloc()
- debugging library, and it notices no problems.
-
- Your wisdom, as always, is appreciated.
-
- Regards,
- Jim
- --- Standard disclaimers apply ---
-